package com.linkwedo.saas.project;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.interceptor.ServletRequestAware;
//
//import com.db.TbTarget;
//import com.db.TbTargetDAO;
import com.linkwedo.saas.domain.Project;
import com.linkwedo.saas.domain.ProjectReview;
import com.linkwedo.saas.domain.Target;
import com.linkwedo.saas.domain.Task;
import com.opensymphony.xwork2.ActionSupport;

public class LoadProjectReviewAction extends ActionSupport implements ServletRequestAware{

	private javax.servlet.http.HttpServletRequest request;
	public void setServletRequest(HttpServletRequest request) {
		// TODO Auto-generated method stub
		this.request=request;
	}
	private ProjectReviewService projectReviewService;
	List list;
	public List getList() {
		return list;
	}

	public void setList(List list) {
		this.list = list;
	}


	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	private static final long serialVersionUID = 8190003683775267839L;
	public String execute() throws Exception {
		String pidStr = request.getParameter("pid");
		Integer pid=null;
		if(null != pidStr){
			pid=new Integer(pidStr);
		}
		System.out.println(pid);
		if(null == pid){
//			pid=5;
			List<ProjectReview> pidList = projectReviewService.findAll();
//			if(null != pidList && !pidList.isEmpty()){
//				pid = pidList.get(0).getId();
//			}
			list =pidList;
		}else{
			try{
				list=projectReviewService.findByProjectID(pid);
			 	for(ProjectReview pro:(List<ProjectReview>)list){
			 	 	System.out.println(pro.getPath());
				}
			}catch(Exception e){
					e.printStackTrace();
			}
			System.out.println("list size"+list.size());
		}
		return "SUCCESS";	
	}

	public ProjectReviewService getProjectReviewService() {
		return projectReviewService;
	}

	public void setProjectReviewService(ProjectReviewService projectReviewService) {
		this.projectReviewService = projectReviewService;
	}
	
	}
